package cn.tedu.charging.account.service.impl;

import cn.tedu.charging.account.dao.persist.repository.IOrderRepository;
import cn.tedu.charging.account.pojo.entity.Order;
import cn.tedu.charging.account.service.IOrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 处理订单数据的业务实现类
 *
 * @author wyy
 * @version 1.0
 */
@Service
@Slf4j
public class OrderServiceImpl implements IOrderService {

    @Autowired
    private IOrderRepository repository;

    @Override
    public void addNew(Order order) {
        int insert = repository.insert(order);
        log.debug("插入了{}条数据", insert);
    }

    @Override
    public void delete(Long id) {
        int delete = repository.deleteById(id);
        log.debug("删除了{}条数据", delete);
    }

    @Override
    public void update(Order order) {
        int update = repository.updateById(order);
        log.debug("修改了{}条数据", update);
    }

    @Override
    public void count(Long userId) {
        int count = repository.countById(userId);
        log.debug("统计了{}条数据", count);
    }
}
